package com.wo.cloud.security;

import com.wo.cloud.util.Response;
import com.wo.cloud.util.ResponseUtil;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2021/4/18 23:20
 * Description: 未认证统一配置
 */
public class UnauthorizationEntryPoint implements AuthenticationEntryPoint {
    @Override
    public void commence(HttpServletRequest request, HttpServletResponse response,
                         AuthenticationException authException) throws IOException, ServletException {
        // 未认证统一配置
        ResponseUtil.out(response, Response.fail("未认证"));
    }
}
